package com.fengye.algorithms.huawei;

import java.util.Scanner;

/**
 * https://www.nowcoder.com/practice/8c949ea5f36f422594b306a2300315da?tpId=37&tqId=21224&rp=1&ru=/exam/oj/ta&qru=/exam/oj/ta&sourceUrl=%2Fexam%2Foj%2Fta%3FtpId%3D37&difficulty=undefined&judgeStatus=undefined&tags=&title=
 * @Author fengye
 * @Date 2023/4/7 10:07
 **/
public class LastWordLengthMain {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        // 注意 hasNext 和 hasNextLine 的区别
        while (in.hasNextLine()) { // 注意 while 处理多个 case
            String inStr = in.nextLine();
            if(null == inStr || inStr.equals("") ) {
                continue;
            }
            char[] ch = inStr.toCharArray();
            int num = 0;
            for(int i=ch.length-1;i>=0;i--) {
                if(ch[i] == ' '){
                    break;
                }
                num++;
            }
            System.out.println(num);
        }
    }
}
